package com.mb.mp.util;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @program: mp-parent
 * @description: ${description}
 * @author: zhanxuewei
 * @create: 2018-03-29 00:50
 **/
public class QueryUtil extends LinkedHashMap<String, Object> {

    private int offset;
    // 每页条数
    private int limit;

    private String areaId;

    public QueryUtil(Map<String, Object> params){
        this.putAll(params);
        // 分页参数
        this.offset = Integer.parseInt(params.get("offset").toString());
        this.limit = Integer.parseInt(params.get("limit").toString());
        this.areaId = (String) params.get("areaId");
        this.put("offset", offset);
        this.put("page", offset / limit + 1);
        this.put("limit", limit);
        this.put("areaId", areaId);
    }
}
